package com.iplay.dao.review;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.transaction.annotation.Transactional;

import com.iplay.entity.review.ReviewDO;

public interface ReviewDAO extends CrudRepository<ReviewDO, Integer>{
	
	Page<ReviewDO> findByHotelId(int hotelId, Pageable pageable);

	@Transactional
	@Modifying
	@Query("update ReviewDO h set h.author = ?2 where h.authorId = ?1")
	int updateAuthor(int authorId, String author);

}
